package Plane;

import Impl.HouseObserver;
import Impl.Subject;
import Model.House;

import java.util.ArrayList;

public class PlaneSituation implements Subject {
    private ArrayList<HouseObserver> observerList;
    private House house;

    public PlaneSituation(House house) {
        this.observerList = new ArrayList<>();
        this.house = house;
    }

    @Override
    public void notifyObserver() {
        for(HouseObserver ob : observerList){
            ob.update(house);
        }
    }

    @Override
    public void addObserver(HouseObserver observer) {
        observerList.add(observer);
    }

    @Override
    public void removeObserver(HouseObserver observer) {
        observerList.remove(observer);
    }
}
